/*
 * GToe: Gtk+ TicTacToe
 * socket.h: socket related
 *
 * Copyright (C) 2010 Dani El-Soufi <danisoufi@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _NETWORK_H
#define _NETWORK_H 1

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

extern int recv_eof;

int establish_listening_socket(unsigned short portno, char ip_addr[INET6_ADDSTRLEN]);
int connect_to_socket(unsigned short portno, char ip_addr[INET6_ADDRSTRLEN]);
int read_from_socket(int connected_socket, char *buffer, int bytes);
int write_to_socket(int connected_socket, char *buffer, int bytes);

#endif /*_NETWORK_H */
